package com.ruoyi.classai.config;


import com.ruoyi.classai.config.interceptor.ApiInterceptor;
import com.ruoyi.common.redis.service.RedisService;

import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * web配置
 */
@AllArgsConstructor
@Configuration
public class ApiWebConfig implements WebMvcConfigurer {
	

	private final RedisService redisService;

	/**
	 * 拦截器
	 * @param registry registry
	 */
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		/**
		 * 进入ThirdSession拦截器
		 */
		registry.addInterceptor(new ApiInterceptor(redisService))
				.addPathPatterns("/api/**")
				.excludePathPatterns("/api/login/teacher")
				.excludePathPatterns("/api/studentClient/studentLogin")
				.excludePathPatterns("/api/model/**");
	}



}
